package router

import (
	"database/sql"

	"gitee.com/hp-huiw/my-go-core/config"
	"github.com/gin-gonic/gin"
)

// GenerateRoutes configures all HTTP route groups and routes.
func GenerateRoutes(router *gin.Engine, db *sql.DB) {
	server := config.ConfigLoader.GetAppConfig().Server
	api := router.Group(server.RouteRootGroupName + server.RouteApiGroupName)

	// Apply route-level middleware if needed
	api.Use()

	// Register routes by feature domain.
	SetAccountGroupRoutes(api.Group("account-group"), db)
	SetAccountGroupUserRoutes(api.Group("account-group-user"), db)
	SetAppErrorReportRoutes(api.Group("app-error-report"), db)
	SetAppReleaseLogRoutes(api.Group("app-release-log"), db)
	SetAuthenticationRoutes(api.Group("authentication"), db)
	SetBankCardRoutes(api.Group("bank-card"), db)
	SetBankRoutes(api.Group("bank"), db)
	SetDataInitializationRoutes(api.Group("data-initialization"))
	SetFileRoutes(api.Group("file"), db)
	SetIncomeExpenseAnalysisRoutes(api.Group("income-expense-analysis"), db)
	SetIncomeExpenseDetailRoutes(api.Group("income-expense-detail"), db)
	SetIncomeExpenseDetailTypeRoutes(api.Group("income-expense-detail-type"), db)
	SetJoinAccountGroupRequestRoutes(api.Group("join-account-group-request"), db)
	SetJourneyRoutes(api.Group("journey"), db)
	SetJourneyIncomeExpenseDetailRoutes(api.Group("journey-income-expense-detail"), db)
	SetMapLocationRoutes(api.Group("map-location"))
	SetRegionRoutes(api.Group("region"), db)
	SetRoleRoutes(api.Group("role"), db)
	SetTokenCheckRoutes(api.Group("token-check"))
	SetUserActiveTokenRoutes(api.Group("user-active-token"), db)
	SetUserRoutes(api.Group("user"), db)
}
